home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-02-02 | 1.8 KB | 70 lines | [TEXT/AxoC] |
- LocalLanguage Pascal
- {-------------------------------------------------
- This document contains a procedure for converting
- between solution concentration and solute weight,
- taking into account the volume of water and the
- molecular weight of the solute.
-
- • To load this function choose "Select All" under
- the "Edit" menu, then press "enter".
-
- --------------------------------------------------}
- Var
- molecularWeight, Volume, Concentration, Weight: Real
-
- {• Single channel properties •}
- procedure Solution
- Var
- done: Boolean
- begin
- done = False
- Repeat
- PoseDialog ('\rCalculate volume, weight or concentration of a solution.\rSet unknown parameter to zero',
- & 'Molecular Weight', molecularWeight,
- & 'Volume : ml', Volume,
- & 'Concentration : mM',Concentration,
- & 'Weight : g',Weight)
-
- if molecularWeight = 0 then { calculate molecular weight }
- begin
- molecularWeight = 1e6* Weight / (Volume * Concentration)
- done = True
- end
- else
- begin
- if Volume = 0 then { calculate Volume in ml }
- begin
- Volume = 1e6* Weight / (molecularWeight * Concentration)
- done = True
- end
- else
- begin
- if Concentration = 0 then { calculate drug concentration in mM }
- begin
- Concentration = 1e6* Weight / (molecularWeight * Volume)
- done = True
- end
- else
- begin
- if Weight = 0 then { calculate weight in g }
- begin
- Weight = Concentration * molecularWeight * Volume / 1e6
- done = True
- end
- end
- end
- end
- if done then
- begin
- writeln ('Molecular Wt. \t\t',molecularWeight)
- writeln ('Volume \t',Volume, ' ml')
- writeln ('Concentration \t',Concentration, ' mM')
- writeln ('Weight \t',Weight, ' g')
- end
- else
- begin
- Alert ('No calculation was performed.\nPlease set the unknown value to zero.')
- end
- Until done
- end
-